/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author Andres
 */
@Entity
@Table(name = "RESERVARECURSO", catalog = "", schema = "PROYECTO")
@NamedQueries({
    @NamedQuery(name = "Reservarecurso.findAll", query = "SELECT r FROM Reservarecurso r"),
    @NamedQuery(name = "Reservarecurso.findByReservaCodigoreserva", query = "SELECT r FROM Reservarecurso r WHERE r.reservaCodigoreserva = :reservaCodigoreserva")})
public class Reservarecurso implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "RESERVA_CODIGORESERVA", nullable = false)
    private Integer reservaCodigoreserva;
    @JoinColumn(name = "RESERVA_CODIGORESERVA", referencedColumnName = "CODIGORESERVA", nullable = false, insertable = false, updatable = false)
    @OneToOne(optional = false, fetch = FetchType.EAGER)
    private Reserva reserva;
    @JoinColumn(name = "RECURSOS_IDRECURSO", referencedColumnName = "IDRECURSO", nullable = false)
    @ManyToOne(optional = false, fetch = FetchType.EAGER)
    private Recursos recursos;

    public Reservarecurso() {
    }

    public Reservarecurso(Integer reservaCodigoreserva) {
        this.reservaCodigoreserva = reservaCodigoreserva;
    }

    public Integer getReservaCodigoreserva() {
        return reservaCodigoreserva;
    }

    public void setReservaCodigoreserva(Integer reservaCodigoreserva) {
        this.reservaCodigoreserva = reservaCodigoreserva;
    }

    public Reserva getReserva() {
        return reserva;
    }

    public void setReserva(Reserva reserva) {
        this.reserva = reserva;
    }

    public Recursos getRecursos() {
        return recursos;
    }

    public void setRecursos(Recursos recursos) {
        this.recursos = recursos;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (reservaCodigoreserva != null ? reservaCodigoreserva.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Reservarecurso)) {
            return false;
        }
        Reservarecurso other = (Reservarecurso) object;
        if ((this.reservaCodigoreserva == null && other.reservaCodigoreserva != null) || (this.reservaCodigoreserva != null && !this.reservaCodigoreserva.equals(other.reservaCodigoreserva))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.Reservarecurso[reservaCodigoreserva=" + reservaCodigoreserva + "]";
    }

}
